using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.MediaCenter.Hosting;
using Microsoft.MediaCenter.ListMaker;
using System.Threading;
using Microsoft.MediaCenter.UI;

namespace ClipShow
{
    public class Gateway : IAddInModule, IAddInEntryPoint
    {

        //
        // Initialize (IAddInModule)
        //

        public void Initialize(Dictionary<string, object> appInfo, Dictionary<string, object> entryPointInfo)
        {

        }


        //
        // Uninitialize (IAddInModule)
        //

        public void Uninitialize()
        {
        }


        //
        // Launch (IAddInModule)
        //

        public void Launch(AddInHost host)
        {
            // Create a named mutex to check whether an instance of this application is already running.
            //bool bMyMutexWasCreated;
            //Mutex myMutex = new Mutex(true, "clipShowMutex", out bMyMutexWasCreated);
            //if (!bMyMutexWasCreated)
            //{
            //    // If we get here, the application is already running; bring it to the foreground.
            //    host.ApplicationContext.ReturnToApplication();
            //}
            //else
            //{
                // If we get here, the application is not running; launch it now.
                Guid appId = new Guid("00f25451-8157-4480-8c2d-68bf7cbfcbe8");
                Guid entryPointId = new Guid("8a0946f8-d239-4feb-b48b-1b5759483a99");
                host.MediaCenterEnvironment.LaunchEntryPoint(appId, entryPointId);
            //}        
        }
    }

}

